<?php
    //ob_end_flush();
    include('class.mysql.php');
    $mydb = new mysql();
    $connection = $mydb->Connect();
    $no_reg = $_GET["q"];
    $no_reg = substr($no_reg,0,5);
    //hitung no urut terakhir
    $sql="select kota,no_urut,no_reg from login where no_reg like '$no_reg%'  order by no_urut desc "; //no_registrasi ex. 001 no_reg ex. 002-40-505-005
    //echo "$sql";	
    $query = $mydb->Query($sql);
    $num = $mydb->FetchNum($query);
    if($array= mysql_fetch_row($query))
    {
	$nomor=$array[1];
	$inomor=(int)$nomor;
	$inomor=$inomor+1;
	if($inomor<10)
	    $no_urut='00'.$inomor;
	else if($inomor<100)
	    $no_urut='0'.$inomor;
	else 
	    $no_urut=(string)$inomor;
	$no_reg=substr($no_reg,0,12).$no_urut;
    }
    else
    {
	$no_urut='001';
	$no_reg=substr($no_reg,0,12).$no_urut;
    }    	
    $mydb->Close;
    setcookie("IDurut", $no_urut, time()+300);
    //echo $no_urut;
    //echo $sql;
 ?> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>

</body>



